package edu.spec.student.dao.impl;

import edu.spec.student.dao.iface.IMentalDao;
import edu.spec.student.model.mental.Mental;
import org.madgecko.basic.dao.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by MadFrog on 2017/6/30.
 */
@Repository
public class MentalDao extends BaseDao<Mental> implements IMentalDao {
    @Override
    public List<Mental> listAll() {
        String hql = "from Mental";
        return this.list(hql);
    }

    @Override
    public List<Mental> listMentalByStudent(Integer studentId) {
        String hql = "select sm.mental from StudentMental sm where sm.student.id=" + studentId;
        return this.list(hql);
    }
}
